[SPARK-58078][CORE] Add PipelinedShuffleDependency#57179
Open
jerrypeng wants to merge 1 commit into
Open
Conversation
Introduce PipelinedShuffleDependency, a ShuffleDependency subtype that declares a shuffle's output can be read incrementally -- a consumer stage may begin reading while the producer is still running. This is the first-class marker a later DAGScheduler change will use to co-schedule the producer and consumer (a 'pipelined group') and to select an incremental shuffle implementation. This PR adds only the type. On its own it behaves exactly like its parent ShuffleDependency -- code that matches ShuffleDependency continues to treat it as an ordinary materialized shuffle -- so it changes no existing behavior. The concurrent-scheduling and incremental-shuffle behavior are added separately. The parent's checksumMismatchFullRetryEnabled / checksumMismatchQueryLevelRoll- backEnabled params are intentionally not exposed, so they stay false: their stage-level recompute-and-rerun is moot for a pipelined group (any failure aborts the whole group and the caller reruns from scratch), and would also conflict with a consumer that has already read the output incrementally. Tests: PipelinedShuffleDependency is-a ShuffleDependency, is distinguishable from an ordinary dependency, registers its shuffle with a distinct shuffleId, keeps the checksum retry/rollback flags false, and forwards non-default constructor args (aggregator, mapSideCombine) to the parent correctly. Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR adds
PipelinedShuffleDependency, a newShuffleDependencysubtype that marks ashuffle's output as incrementally readable: a consumer stage may begin reading the output
while the producer stage is still running, rather than waiting for the producer's full,
materialized output.
Class hierarchy:
Dependency[T]
ShuffleDependency[K, V, C]
PipelinedShuffleDependency[K, V, C] <- new
This PR adds only the type. On its own,
PipelinedShuffleDependencybehaves exactly like itsparent
ShuffleDependency— construction goes through the normal path (shuffle id allocation,ShuffleManager.registerShuffle, cleaner registration), and any code that matches onShuffleDependencycontinues to treat it as an ordinary, fully-materialized shuffle. It introducesno behavior change. It is the marker that a later
DAGSchedulerchange will use to (a)co-schedule the producer and consumer stages connected by this edge (a "pipelined group") and (b)
select an incremental shuffle implementation for this edge. That concurrent-scheduling and
incremental-shuffle behavior is added in follow-up PRs.
The parent's
checksumMismatchFullRetryEnabled/checksumMismatchQueryLevelRollbackEnabledconstructor parameters are intentionally not exposed by the subclass, so they stay at their
falsedefaults. Their checksum-mismatch model recomputes and re-runs succeeding stages after a mismatch;
in the pipelined-group failure model any failure aborts the whole group and the caller reruns from
scratch, so that stage-level recompute never fires, and it would also conflict with a consumer that
has already read the output incrementally.
This is the first PR in a stack that incrementally introduces pipelined shuffle dependencies and
concurrent stage scheduling.
Why are the changes needed?
Today a multi-stage job runs one stage at a time: each shuffle is fully materialized before the next
stage starts. Some workloads (initially Structured Streaming real-time mode) need the stages of a
single job to run concurrently, connected by a shuffle whose consumer reads the producer's output as
it is produced. Expressing that requires a first-class, distinguishable dependency kind that the
scheduler and shuffle layers can key off of. This PR introduces that primitive as the foundation the
subsequent scheduler and shuffle-layer changes build on, split out on its own so it can be reviewed
in isolation without any behavioral risk.
Does this PR introduce any user-facing change?
No. The new class is a
@DeveloperApiaddition that changes no existing behavior; nothing constructsa
PipelinedShuffleDependencyyet, and it is handled identically to an ordinaryShuffleDependencyeverywhere.
How was this patch tested?
New unit tests in
ShuffleDependencySuite(all passing) verify that aPipelinedShuffleDependency:ShuffleDependency(so existingShuffleDependencymatches continue to apply) andpreserves its fields (partitioner, key/value class names, rdd);
shuffleHandleis produced) and a second instancereceives a distinct
shuffleId;checksumMismatchFullRetryEnabledandchecksumMismatchQueryLevelRollbackEnabledatfalse;aggregator,mapSideCombine) toShuffleDependencycorrectly (positional-forwarding guard);
and that an ordinary
ShuffleDependencyis not aPipelinedShuffleDependency(negative case).build/sbt 'core/testOnly org.apache.spark.shuffle.ShuffleDependencySuite'
...
Tests: succeeded 6, failed 0
Was this patch authored or co-authored using generative AI tooling?
co-authored: Claude Code (Opus 4.8)